package sk.mka.phd.googleagent.config;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.apache.log4j.Logger;

/**
 *
 * @author katrami
 * @date Dec 14, 2010
 */
public class MavenSingletonConfig {

    private static MavenSingletonConfig config;
    private final Properties enviroment;
    private static final Logger log = Logger.getLogger(MavenSingletonConfig.class);

    public static MavenSingletonConfig getInstance(final String propertiesFilename) {

        if (config == null) {
            config = new MavenSingletonConfig(propertiesFilename);
        }
        return config;
    }

    private MavenSingletonConfig(String propertiesFilename) {
        enviroment = new Properties();
        try {
            enviroment.load(new FileInputStream(propertiesFilename));

        } catch (IOException ex) {
            log.debug(ex);
        }
    }

    public Properties getEnviroment() {
        return enviroment;
    }
}
